package com.hava.contentsale.dao;

import com.hava.contentsale.meta.PersonPO;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * Created by yanfa on 2016/11/9.
 */
public interface PersonDao {

    @Select("SELECT * FROM person")
    public List<PersonPO> findAll();

    @Select("SELECT * FROM person WHERE(id = #{param1})")
    public PersonPO findOne(Long id);

    @Options(useGeneratedKeys=true,keyProperty = "id")
    @Insert("INSERT INTO person (userName,password,nickName,userType) VALUES (#{userName},#{password},#{nickName},#{userType})")
    public void create(PersonPO person);

    @Update("UPDATE person SET userName=#{userName},password=#{password},nickName=#{nickName},userType=#{userType} WHERE (id = #{id})")
    public void update(PersonPO person);

    @Delete("DELETE FROM person WHERE(id = #{param1})")
    public void delete(Long id);
}
